<template>
	<view class="page">

			<view class="uni-search-bar">
				<uni-search-bar  disabled placeholder="搜索科室,医生" cancel-button="none" radius="100"/>
			</view>
			<!--轮播图开始 -->
			<view class="uni-margin-wrap">
				<unicloud-db v-slot:default="{data, loading, error, options}" collection="opendb-banner">
					<view v-if="error">{{error.message}}</view>
					<view v-else>
						<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
						  <swiper-item v-for="(item, index) in data" :key="item._id">
						    <view class="swiper-item">
						      <image class="banner-image" :src="item.bannerfile.url" mode="aspectFill" :draggable="false" />
						    </view>
						  </swiper-item>
						</swiper>
					</view>
				</unicloud-db>
			</view>
			<!-- 轮播图结束 -->
			
			<!-- 会员权益开始 -->
			<view class="vip-wrop">
				<uni-card title="">
					<!-- 权益开始 -->
					<uni-grid :column="number">
						<uni-grid-item>
							<view class="grid-item-box">
								<image 
								            src="../../static/tabbar/img007.png"
								            mode="aspectFill" 
								            style="width: 90%; height: 100%;" 
								        />
							</view>
						</uni-grid-item>
						<uni-grid-item>
							<view class="grid-item-box">
								<image
								            src="../../static/tabbar/img008.png"
								            mode="aspectFill" 
								            style="width: 90%; height: 100%;" 
								        />
							</view>
						</uni-grid-item>
						<uni-grid-item>
							<view class="grid-item-box">
								<image
								            src="../../static/tabbar/img009.png"
								            mode="aspectFill" 
								            style="width: 90%; height: 100%;" 
								        />
							</view>
						</uni-grid-item>
						
					</uni-grid>
					<!-- 权益结束 -->
				</uni-card>
			</view>
			<!-- 会员权益结束 -->
			<view class="vip-wrap">
				<uni-card title="名医简介" :thumbnail="vipIcon" margin="15px">
					<view class="doctorlist">
						<unicloud-db v-slot:default="{data, loading, error, options}" collection="doctor">
							<view v-if="error">{{error.message}}</view>
							<view v-else>
								<uni-list>
									<uni-list-item v-for="(item, index) in data">
									  <template v-slot:header>
									    <view class="slot-box">
									      <image class="slot-image" :src="item.photo.url" mode="widthFix"></image>
									    </view>
									  </template>
									    <template v-slot:body>
									      <view class="name">
									        <text>{{item.name}}:</text>
									      </view>
									      <view class="introduce">
									        <text>职称 | {{ item.title }}</text>
									        <text>科室 | {{ item.department }}</text>
											<text>主治 | {{ item.indication}}</text>
									      </view>
									    </template>
									</uni-list-item>
								</uni-list>
							</view>
						</unicloud-db>
					</view>
				</uni-card>
			</view>
		</view>
</template>

<script>
	export default {
		data() {
			return {
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,
				number:3,

				vipIcon: '/static/vip/hospital.png',
			}
		},
		methods: {
			
		}
	}
</script>

<style scoped>
	view {
			display: flex;
			box-sizing: border-box;
			flex-direction: column;
		}
		.slot-box {
		  display: flex;
		  flex-direction: row;
		  align-items: center;
		}
		
		.slot-image {
		  display: block;
		  margin-right: 10px;
		  width: 200rpx;
		  height: 200rpx;
		}
		.page{
			background-color: #EEEEEE;
		}
		.header{
			display: flex;
			flex-direction: row;
			background-color: #FFFFFF;
		}
		.locationName{
			display: flex;
			flex-direction: row;
			height: 50px;
			line-height: 50px;
			font-size: 12px
		}
		.uni-search-bar{
			width: 580rpx;
			height: 50px;
		}
		.classify_wrap {
			width: 750rpx;
			display: flex;
			flex-direction: row;
		}
		.classify_scroll_x{
			white-space: nowrap;
			width: 650rpx;
			background-color: #FFFFFF;
			margin-top: 5rpx;
			margin-bottom: 8rpx;
		}
		.classify_icon{
			display: flex;
			flex: 1;
			background-color: #FFFFFF;
			margin-left: 3rpx;
			margin-top: 5rpx;
			margin-bottom: 8rpx;
		}
		.segmented-wrap{
			width: 1300rpx;
		}
		.scroll-view-item_H {
			display: inline-block;
			width: 140rpx;
			height: 90rpx;
			line-height: 90rpx;
			text-align: center;
			font-size: 12rpx;
		}
		.scroll-view-item_selected{
			border-bottom: 2px solid red;
		}
		.uni-margin-wrap{
			margin-top: 5rpx;
			display: flex;
			flex: 1;
		}
		.swiper{
			height: 315rpx;
		}
		.banner-image {
			width: 750rpx;
			height: 315rpx;
		}
		.grid-item-box {
		    width: 100%; /* 设定视图的宽度 */
		    height: 100%; /* 设定视图的高度 */
		   overflow: hidden; /* 超出部分隐藏 */
		}
		.grid-item-box2{
			width: 100rpx;
			height: 100rpx;
		}
		.text-distance{
			text-align: center;
		}
		.introduce{
		  font-size: 24rpx;
		  white-space: nowrap; /* 禁止换行 */
		  overflow: hidden; /* 隐藏溢出内容 */
		  text-overflow: ellipsis; /* 使用省略号表示文本溢出 */
		  word-break: break-all; /* 允许在单词内换行 */
		  margin-bottom: 10rpx;
		  color: #666666;
		}
		.name{
		  font-size: 30rpx;
		  display: -webkit-box;
		  line-height: 1.5em;
		  -webkit-box-orient: vertical;
		  -webkit-line-clamp: 2;
		  overflow: hidden;
		  text-overflow: ellipsis;
		  margin-bottom: 5rpx;
		}
</style>